home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
jjbqc.zip
/
JJBSHOW5.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-04
|
7KB
|
178 lines
/**************************************************************************
* *
* JJBSHOW5.C *
* *
* Copyright (c) 1989, JJB. All rights reserved. *
* *
* *
* This example shows you how to use the 'enter' functions so you can *
* input entire screens of data. *
* *
* JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635 *
**************************************************************************/
/***************************************************************************
* *
* To make an .exe file JJBSHOW5.EXE for this program, from DOS enter: *
* *
* QCL /c /AM JJBSHOW5.C *
* LINK JJBSHOW5.OBJ + JJB + JJBINPUT+JJBDOLLR ,,, C:LIB\, *
* *
***************************************************************************/
#include "c:\bin\jjbkbd.h"
#include "c:\bin\jjbset.h"
main() {
jjb_initalize(); /* initalize the jjb functions */
jjb_setup(); /* set up your options and assign functions*/
jjb_start(); /* start executing the default option */
}
/****************************************************************************
* *
* SAMPLE ENTER FUNCTION *
* *
****************************************************************************/
update_cust() { int x; unsigned long lfrom, lto;
char buffer[256]; /* customer I/O buffer */
/* define the define pointers */
char *name, *street, *city, *phone1, *phone2, *phone3,
*comment, *mo, *day, *year, *check , *amt,
*pak = " "; /* for press any key */
/* define the data lengths. */
/* if you change any data length, the buffer pointers below
will automatically be adjusted for the new address */
int lname = 44,
lstreet = 30,
lcity = 30,
lphone1 = 3,
lphone2 = 3,
lphone3 = 4,
lcomment = 30,
lmo = 2,
lday = 2,
lyear = 2,
lcheck = 6,
lamt = 14;
x=1;
/* store buffer address in the character pointers */
name = &buffer[x]; x += lname +1;
street = &buffer[x]; x += lstreet +1;
city = &buffer[x]; x += lcity +1;
phone1 = &buffer[x]; x += lphone1 +1;
phone2 = &buffer[x]; x += lphone2 +1;
phone3 = &buffer[x]; x += lphone3 +1;
comment = &buffer[x]; x += lcomment +1;
mo = &buffer[x]; x += lmo +1;
day = &buffer[x]; x += lday +1;
year = &buffer[x]; x += lyear +1;
check = &buffer[x]; x += lcheck +1;
amt = &buffer[x]; x += lamt +1;
/*a zero data buffer */
for (x=0; x<256; ++x) buffer[x] = '\0';
/* Normally you would read the data file, but since we don't have a data
file in this example, we need to fill the data buffer as follows: */
name = "John Thomas Wellington";
street = "1527 South Meadow Road";
city = "Dallas, TX 75247";
phone1 = "214"; phone2 = "357"; phone3 = "8934";
comment = "Place any comment here";
mo = "11"; /* JJB S&W (strings & windows) will be */
day = "24"; /* released in 1989 and it will have */
year = "88"; /* complete date handling source for you. */
check = "34512";
amt = "";
vloc(15,22); vfs("( ) -"); /* for phone number */
vloc(19,22); vfs(" - - "); /* for date */
vloc(4,3); vfs("Note: ");
/* Notice '1,9' on next line. It means down 1, over 9 */
vfscr("At any time while entering, you can press: ALT to exit",1,9);
vfscr("UP or DOWN ARROWS to move cursor, '*' to remove data.");
vfscr("Plus any assigned function keys F1 thru F8, or F9 to DOS. ");
vfscr("SPACE BAR is same as RETURN if first character entered.");
/* BEGIN....AGAIN is a continuous while loop */
/* eptr(4) will be true only if the entry pointer equals 4 */
/* Each enter( increments the entry pointer by 1 */
/* In addition to entering, JJB also displays the data from the buffer */
/* Since the buffer is updated directly, the only thing left for the */
/* programmer to do is to read & write the record to the disk file. */
/* The first time thru the enter( will just display the screen. */
/* until it starts with (x) */
eptr_reset(); /* set eptr (enter pointer) to 1 */
lfrom = 100; /* see enter_lnum( below */
lto = 999998;
BEGIN
if (eptr(1)) enter(9,9 , "Enter name: ",name, lname);
if (eptr(2)) enter(11,12, " street: ",street, lstreet);
if (eptr(3)) enter(13,12, " city: ",city, lcity);
if (eptr(4)) enter_num(15,12, " phone: ",phone1, lphone1,100,999,15,23);
if (eptr(5)) enter_num(15,12, " phone: ",phone2, lphone2,100,999,15,28);
if (eptr(6)) enter_num(15,12, " phone: ",phone3, lphone3,1000,9999,15,32);
if (eptr(7)) enter (17,12, "comment: ",comment, lcomment,17,22);
if (eptr(8)) enter_num (19,12," date: ",mo, lmo, 1,12,19,22);
if (eptr(9)) enter_num (19,12," date: ",day, lday, 1,31,19,25);
if (eptr(10)) enter_num (19,12," date: ",year,lyear,0,99,19,28);
if (eptr(11)) enter_lnum (21,12," check#: ",check,lcheck,lfrom,lto,21,23);
if (eptr(12)) enter_dollar(23,12," amount:",amt, 23,22);
if (eptr(13)) {enter(23,50 ,"Press any key ",pak, 1);
vloc(23,50); vspaces(22);}
eptr_start_with(1); /* turn off displaying and start entering */
AGAIN
}
jjb_setup() {
group("Update");
option("Update customer file");
funct(update_cust);
option("Type the");
option("Description to");
option("Your options here.",DRAWLINE);
option("Each group can");
option("have as many ");
option("Options as you need.");
group("Other");
option("These options have no");
option("functions assigned to them.");
}